import { getCategoryAPI } from '@/api/category'
export default {
  namespaced: true,
  state: () => ({
    categoryList: []
  }),
  mutations: {
    setCategoryList (state, list) {
      state.categoryList = list
    }
  },
  actions: {
    async asyncSetCategoryList (ctx) {
      const res = await getCategoryAPI()
      // 调用muation函数 把获取到的值交给state categoryList
      ctx.commit('setCategoryList', res.result)
    }
  }
}
